<template>
  <div>
    <introduce>
      <span class="title-gray" slot="pre">测量类型/</span>
      <span class="title-bold" slot="title">添加测量类型</span>
      <span slot="info"> - 可添加新的传感器类型。</span>
    </introduce>
    <el-card>
      <el-form :model="addForm">
        <el-form-item label="测量名称" prop="name">
          <el-input v-model="addForm.name" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="测量单位" prop="unit">
          <el-input v-model="addForm.unit" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            size="mini"
            style="margin-left: 70px"
            @click="addMeasure"
            >确认</el-button
          >
          <el-button size="mini">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import Introduce from "@/components/Introduce.vue";
import { $measureAdd } from "@/api/index";
export default {
  name: "addMeasure",
  components: { Introduce },
  data() {
    return {
      addForm: {
        name: "",
        unit: "",
      },
    };
  },
  methods: {
    addMeasure() {
      $measureAdd({ name: this.addForm.name, unit: this.addForm.unit }).then(
        (res) => {
          console.log(res.data);
          if (res) {
            this.$message.success("添加成功");
          }
        }
      );
    },
  },
};
</script>

<style>
</style>